package structs

const (
	TaskStatusCreated    = "created"    // 刚创建完成
	TaskStatusPrepared   = "prepared"   // 手机号准备完成
	TaskStatusProcessing = "processing" // 发送中
	TaskStatusPaused     = "paused"     // 暂停
	TaskStatusStopped    = "stopped"    // 停止&弃用
	TaskStatusCompleted  = "completed"  // 完成
)

const (
	ReportKindSmsSend                = "sms_send"                 // 发送短信
	ReportKindSmsFail                = "sms_fail"                 // 发送失败
	ReportKindSmsClick               = "sms_click"                // 点击短信链接
	ReportKindInsurancePolicy        = "insurance_policy"         // 访问保险投保成功页面
	ReportKindInsurancePolicyUpgrade = "insurance_policy_upgrade" // 访问保险投保成功页面-保险升级页面
	ReportKindViewMp                 = "view_mp"                  // 访问小程序
	ReportKindWecom                  = "wecom"                    // 加入企业微信
)

const (
	TaskTempProgressKey     = `task_temp_progress_%d`
	TaskTempProgressFailKey = `task_temp_progress_fail_%d`
)

const (
	// 激活过期key
	ActiveExpireKey = `active_expire_%s_%s`
)

type PageBase struct {
	Current  int32 `form:"current"`
	PageSize int32 `form:"pageSize" binding:"required" validate:"gt=0"`
}

func (pb *PageBase) Offset() int32 {
	if pb.Current == 0 {
		return 0
	}
	return (pb.Current - 1) * pb.PageSize
}
